package io.renren.modules.comment_data_1.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.comment.service.V9CommentService;
import io.renren.modules.comment_data_1.dao.V9CommentData1Dao;
import io.renren.modules.comment_data_1.entity.V9CommentData1Entity;
import io.renren.modules.comment_data_1.service.V9CommentData1Service;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 评论管理
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-09-24 18:03:20
 */
@RestController
@RequestMapping("comment_data_1/v9commentdata1")
public class V9CommentData1Controller {
    @Autowired
    private V9CommentData1Service v9CommentData1Service;
    @Autowired
    private V9CommentData1Dao v9CommentData1Dao;
    @Autowired
    private V9CommentService v9CommentService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("comment_data_1:v9commentdata1:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = v9CommentData1Service.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("comment_data_1:v9commentdata1:info")
    public R info(@PathVariable("id") Integer id){
		V9CommentData1Entity v9CommentData1 = v9CommentData1Service.getById(id);
        return R.ok().put("v9CommentData1", v9CommentData1);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("comment_data_1:v9commentdata1:save")
    public R save(@RequestBody V9CommentData1Entity v9CommentData1){
		v9CommentData1Service.save(v9CommentData1);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("comment_data_1:v9commentdata1:update")
    public R update(@RequestBody V9CommentData1Entity v9CommentData1){
		v9CommentData1Service.updateById(v9CommentData1);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("comment_data_1:v9commentdata1:delete")
    public R delete(@RequestBody Integer[] ids){
		v9CommentData1Service.removeByIds(Arrays.asList(ids));

        return R.ok();
    }
}
